﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ww.wwf.wwfbll;
using ww.lis.lisbll.sam;
using System.Collections;
using System.IO;

namespace ww.form.lis.sam.qc
{
    public partial class QC_DataAutoForm : ww.form.wwf.SysBaseForm
    {
        string finstr_id = "";
        string fzkp_id = "";

        public QC_DataAutoForm(string finstrid,string fzkpid)
        {
            InitializeComponent();
            finstr_id = finstrid;
            fzkp_id = fzkpid;
        }

        private void QC_DataAutoForm_Load(object sender, EventArgs e)
        {
            fjy_dateDateTimePicker1.Value = System.DateTime.Now;
            fjy_dateDateTimePicker2.Value = System.DateTime.Now;
            lbl_finstr.Text = lbl_finstr.Text + WWFInit.wwfRemotingDao.DbExecuteScalarBySql(WWFInit.strDBConn, "select fname from SAM_INSTR where finstr_id='" + finstr_id + "'");
            lbl_zkp.Text = lbl_zkp.Text + WWFInit.wwfRemotingDao.DbExecuteScalarBySql(WWFInit.strDBConn, "SELECT 中文名称+'|'+批号+'|'+生产厂家+'|'+convert(varchar(10),使用日期,121) 质控品 FROM SAM_ZK_ZKP  where 编号='" + fzkp_id + "'");
        }

        private void buttonTC_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button保存_Click(object sender, EventArgs e)
        {
            if (fjy_dateDateTimePicker2.Value < fjy_dateDateTimePicker1.Value)
            {
                WWMessage.MessageShowError("日期范围有误，请检查！");
                this.ActiveControl = fjy_dateDateTimePicker1;
                return;
            }

            if (WWMessage.MessageDialogResult("该操作会自动覆盖以前的质控数据，你确认码？"))
            {

                WWFInit.wwfRemotingDao.DbExecuteScalarBySql(WWFInit.strDBConn, "exec Lis_Ins_Result_QCDataAuto '" + finstr_id + "','" + fzkp_id + "','" + fjy_dateDateTimePicker1.Value.ToString("yyyy-MM-dd") + "','" + fjy_dateDateTimePicker2.Value.ToString("yyyy-MM-dd") + "'");
                this.DialogResult = DialogResult.OK;
            }
        }


    }
}